﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace KPIS.GERP.WEB.GAMS.Classes
{
	public static class CompareUtility
	{
		public static bool IsStringsEqual(string str1, string str2)
		{
			str1 = MakeStringEmptyAndLower(str1);
			str2 = MakeStringEmptyAndLower(str2);
			return str1.Equals(str2);
		}

		// Use with care
		public static bool IsObjectToStringEqual(object obj1, object obj2)
		{
			obj1 = MakeStringEmptyAndLower(obj1 == null ? string.Empty:obj1.ToString());
			obj2 = MakeStringEmptyAndLower(obj2 == null ? string.Empty : obj2.ToString());
			return obj1.Equals(obj2);
		}

		public static string MakeStringEmptyAndLower(string str)
		{
			return (str ?? string.Empty).ToLower();
		}
	}
}